const mysql = require('mysql');

let db = mysql.createConnection({host:'localhost',user:'root',password:'admin',port:3306, database:'mydatabase'});

db.query('select * from user',(err,data)=>{
    if(err){
        console.log('错了',err);
    }
    console.log(data);
});
db.query(`insert into user(name,age) values('李四',39)`,(err,data)=>{
    if(err){
        console.log('发生错误',err);
    }
    console.log(data);
})